<template>
<div>
    <table>
        <tr>
            <td>用户名</td>
            <td><input type="text" v-model="uname" /> </td>
        </tr>
        <tr>
            <td>用户名</td>
            <td><input type="password" v-model="upwd" /> </td>
        </tr>
        <tr>
            <td colspan="2"> <input type="button" value="提交" @click="Create()" /> </td>
           
        </tr>
    </table>
</div>
</template>
<script lang="ts" setup>
import {ref} from "vue";
import axios from "axios";
let uname = ref("");
let upwd = ref("");
function Create(){
    if(uname.value == "" || upwd.value ==""){
        alert("用户名 密码不能为空");
        return;
    }
    axios.post("https://localhost:44322/Add",{
        Usert_Name:uname.value,
        Usert_PWD:upwd.value
    })
    .then(function(res){
        console.log(res.data);
        if(res.data==null || res.data.length==0){
            alert("添加失败");
        }
    })

}
</script>